package edu.ynu.se.xiecheng.achitectureclass.project.dao;

import edu.ynu.se.xiecheng.achitectureclass.common.dao.LogicDAO;
import edu.ynu.se.xiecheng.achitectureclass.project.po.entity.CaptureImage;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CaptureImageDAO extends LogicDAO<CaptureImage, Long> {

    // 获取最近的n条记录
    @Query(value = "SELECT * FROM capture_image WHERE is_deleted = 0 ORDER BY timestamp DESC LIMIT :limit", nativeQuery = true)
    List<CaptureImage> findTopByOrderByTimestampDesc(@Param("limit") int limit);

}
